﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Chat
{
    public abstract class CmdEventArgs<BaseCmd> : EventArgs where BaseCmd : Command
    {
        public BaseCmd CommandReceived { get; protected set; }
        public CmdEventArgs(BaseCmd commandReceived)
        {
            CommandReceived = commandReceived;
        }
    }

    public abstract class CmdProcessor<InCmd>
        where InCmd : Command
    {
        public CmdProcessor()
        {
        }

        public InCmd ProcessCommand(ICmdReceiver<InCmd> receiver)
        {
            InCmd inCmd = receiver.ReceiveCommand();
            ProcessCommand(inCmd);
            return inCmd;
        }

        public abstract void ProcessCommand(InCmd baseCmd);
    }
}
